﻿using System.Windows.Data;
using DeepEarth.Core.Data;
using System.Windows;
namespace DeepEarth.Map.Core
{
    public class LabelVisibilityConverter : IValueConverter
    {
        ILayer layer;
        public LabelVisibilityConverter(ILayer layer)
        {
            this.layer = layer;
        }

        object Convert(object value, System.Type targetType)
        {
            if (layer.IsVisible)
            {
                bool vis = (bool)value;
                if (vis)
                {
                    return Visibility.Visible;
                }
            }

            return Visibility.Collapsed;           
        }

        public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return Convert(value, targetType);
        }

        public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new System.NotImplementedException();
        }
    }
}
